﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.mainmenu {
    import flash.events.*;
    import org.robotlegs.core.*;
    import net.wooga.pets.events.*;
    import __AS3__.vec.*;
    import net.wooga.pets.models.vo.*;
    import net.wooga.pets.views.components.mainmenu.*;

    public class ObjectsTabMediator extends AbstractShopTabMediator implements IMediator {

        override public function onRegister():void{
            tabDisplay.category = ShopItemVO.CATEGORY_OBJECTS;
            eventMap.mapListener(eventDispatcher, BuildingEvent.FACADE_CHANGED, this.facadeChanged);
            super.onRegister();
        }
        private function facadeChanged(_arg1:BuildingEvent):void{
            this.addShopItems();
        }
        override protected function addShopItems():void{
            var _local1:ShopItemDisplay;
            var _local4:ShopItemVO;
            var _local2:Boolean = gameStateModel.isFacadeVisible;
            var _local3:Vector.<ShopItemDisplay> = tabDisplay.getAllItems();
            for each (_local1 in _local3) {
                _local1.removeEventListener(MouseEvent.CLICK, item_click);
                _local1.remove();
                _local1 = null;
            };
            tabDisplay.gotoIndex(0);
            for each (_local4 in shopModel.shopItems) {
                if (((_local2) && ((_local4.location == ShopItemVO.LOCATION_OUTSIDE)))){
                    addShopItem(_local4);
                } else {
                    if (((!(_local2)) && ((_local4.location == ShopItemVO.LOCATION_INSIDE)))){
                        addShopItem(_local4);
                    };
                };
            };
        }

    }
}//package net.wooga.pets.views.mainmenu 
